package com.linkoog.devtools.maven.version_show.persistent;

import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@State(name = "maven-version", storages = @Storage("maven-version.xml"))
public class MavenPluginSettings implements PersistentStateComponent<MavenPluginSettings> {

    public static MavenPluginSettings getInstance(@NotNull Project project) {
        return project.getService(MavenPluginSettings.class);
    }

    private boolean showVersionOnFile = true;
    private boolean showVersionOnTitleBar = true;


    @Nullable
    @Override
    public MavenPluginSettings getState() {
        return this;
    }

    @Override
    public void loadState(@NotNull MavenPluginSettings state) {
        this.showVersionOnFile = state.showVersionOnFile;
        this.showVersionOnTitleBar = state.showVersionOnTitleBar;
    }

    public boolean isShowVersionOnFile() {
        return showVersionOnFile;
    }

    public void setShowVersionOnFile(boolean showVersionOnFile) {
        this.showVersionOnFile = showVersionOnFile;
    }

    public boolean isShowVersionOnTitleBar() {
        return showVersionOnTitleBar;
    }

    public void setShowVersionOnTitleBar(boolean showVersionOnTitleBar) {
        this.showVersionOnTitleBar = showVersionOnTitleBar;
    }
}
